/*
 * ConditionVariable.cpp
 *
 *  Created on: Nov 5, 2012
 *      Author: lucas
 */

#include "ConditionVariable.h"



ConditionVariable::~ConditionVariable() {
	pthread_cond_destroy(&cv);
}


ConditionVariable::ConditionVariable(Mutex& m) : mutex(m) {
	pthread_cond_init(&cv, NULL);
}

void ConditionVariable::signal() {
	pthread_cond_signal(&cv);
}

void ConditionVariable::wait() {
	pthread_cond_wait(&cv, &(mutex.m));
}


